home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000062_icon-group-sender _Mon Sep 20 14:57:32 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  2KB

  1. Received: from owl.CS.Arizona.EDU by cheltenham.CS.Arizona.EDU; Mon, 20 Sep 1993 15:07:35 MST
  2. Received: by owl.cs.arizona.edu; Mon, 20 Sep 1993 15:07:34 MST
  3. Date: Mon, 20 Sep 93 14:57:32 -0400
  4. From: ptho@seq1.loc.gov (Phillip Lee Thomas)
  5. Message-Id: <9309201857.AA05326@seq1.loc.gov>
  6. To: icon-group@cs.arizona.edu
  7. Subject: Yet another question...
  8. Status: R
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. About Chris Fagyal's text search problem...
  12.  
  13. There is too little information in the problem to give an
  14. optimal answer. Problems are: 1) are all data lines of two
  15. lines each? 2) How big is the database?
  16.  
  17. Brute force: Your index lines are totally numeric, so 1)match for
  18. a number in column one and see if you can convert the whole line
  19. into a number. If you can and the number is the one you are looking
  20. for, keep reading until the next index.
  21.  
  22. Indexed: Keep a separate file of where each number is located and
  23. seek to that location. The index file could be kept in memory for
  24. faster access.
  25.  
  26. Binary: Seek to the middle of your file, read until you get a number
  27. line. If the number is too big, seek half way between the start and
  28. the current position, etc. Be sure to test your boundaries so that
  29. you can retrieve the first and last index lines.
  30.  
  31. Your main problems are over whether the entire file can be kept in
  32. memory or only the index or neither and whether you have some structure
  33. to the data lines.
  34.  
  35. The icon library has some functions that might provide a model: see
  36. idxtext and associated procedures.
  37.  
  38. Phillip Lee Thomas
  39. Library of Congress
  40. ptho@seq1.loc.gov
  41.